package com.example.aihub.config;

import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ModelMapper配置类
 * 提供ModelMapper实例，用于实体类和DTO之间的转换
 */
@Configuration
public class ModelMapperConfig {

    /**
     * 创建并配置ModelMapper实例
     * @return ModelMapper实例
     */
    @Bean
    public ModelMapper modelMapper() {
        ModelMapper modelMapper = new ModelMapper();
        // 设置匹配策略为严格匹配
        modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
        return modelMapper;
    }
}